
import 'package:yp/base/response_entity.dart';
import 'package:yp/base/response_list_entity.dart';

import 'customer_entity.dart';
import 'kocList_entity.dart';
import 'favoriteList_entity.dart';
import 'demo_entity.dart';
import 'user_entity.dart';
import 'order_entity.dart';

class EntityFactory {
  static T generateObject<T>(json) {
    if (T.toString() == "HttpResponseEntity") {
      return HttpResponseEntity.fromJson(json) as T;
    } else if (T.toString() == "HttpResponseListEntity") {
      return HttpResponseListEntity.fromJson(json) as T;
    } else if (T.toString() == "UserEntity") {
      return UserEntity.fromJson(json) as T;
    } else if (T.toString() == "DemoEntity") {
      return DemoEntity.fromJson(json) as T;
    }  else if (T.toString() == "CustomerEntity") {
      return CustomerEntity.fromJson(json) as T;
    } else if (T.toString() == "KocListEntity") {
      return KocListEntity.fromJson(json) as T;
    }else if (T.toString() == "FavoriteEntity") {
      return FavoriteEntity.fromJson(json) as T;
    }else if (T.toString() == "OrderEntity") {
      return OrderEntity.fromJson(json) as T;
    } else {
      return json;
    }
  }
}
